//好友列表
export const getFrendList = () => {
  const data = [
    {
      frendId: "1",
      frendName: "土豆哥",
      avatar: "https://xsgames.co/randomusers/avatar.php?g=pixel&key=1",
      message: "你好",
      time: "12:40",
      status: "离线",
      type: "frend",
      count: 4
    },
    {
      frendId: "2",
      frendName: "示例群聊",
      avatar: "https://xsgames.co/randomusers/avatar.php?g=pixel&key=1",
      message: "产品",
      time: "12:40",
      status: "在线",
      type: "group",
      count: 0
    },
    {
      frendId: "3",
      frendName: "react交流",
      avatar: "https://xsgames.co/randomusers/avatar.php?g=pixel&key=1",
      message: "晚上",
      time: "12:40",
      status: "离线",
      type: "file",
      count: 1
    }
  ];
  return data;
};

//好友信息
export const getFrendInfo = (frendId) => {
  const list = getFrendList();
  const frend = list.find((x) => x.frendId === frendId);
  return frend;
};

//获取聊天列表
export const getChatList = () => {
  const data = [
    {
      chatId: "1",
      chatName: "土豆哥",
      avatar: "https://xsgames.co/randomusers/avatar.php?g=pixel&key=1",
      message: "你好",
      time: "12:40",
      status: "离线",
      type: "frend",
      count: 4
    },
    {
      chatId: "2",
      chatName: "示例群聊",
      avatar: "https://xsgames.co/randomusers/avatar.php?g=pixel&key=1",
      message: "产品",
      time: "12:40",
      status: "在线",
      type: "group",
      count: 0
    },
    {
      chatId: "3",
      chatName: "react交流",
      avatar: "https://xsgames.co/randomusers/avatar.php?g=pixel&key=1",
      message: "晚上",
      time: "12:40",
      status: "离线",
      type: "file",
      count: 1
    }
  ];
  return data;
};

//新好友列表
export const getNewFrendList = () => {
  const data = [
    {
      frendId: "1",
      frendName: "张三",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      frendId: "2",
      frendName: "李四",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      frendId: "3",
      frendName: "王五",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      frendId: "4",
      frendName: "赵六",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    }
  ];
  return data;
};

//获取我的群列表
export const getGroupList = () => {
  const data = [
    {
      groupId: "1",
      groupName: "地震预警群",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      groupId: "2",
      groupName: "工作群",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      groupId: "3",
      groupName: "摄影群",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      groupId: "4",
      groupName: "react技术交流群",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    }
  ];
  return data;
};

//黑名单列表
export const getBlackList = () => {
  const data = [
    {
      frendId: "1",
      frendName: "张三",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      frendId: "2",
      frendName: "李四",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      frendId: "3",
      frendName: "王五",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    },
    {
      frendId: "4",
      frendName: "赵六",
      description: "我是大学同学，张飞",
      avatar: "'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg'"
    }
  ];
  return data;
};

//获取消息历史记录
export const getMessageHistoryList = (id) => {
  const msgData = [
    {
      id: "1",
      sendId: "1",
      toId: "2",
      msg: `.Sidebar {
                  display: flex;
                  flex-direction: column;
                  flex-shrink: 0;
                  width: 60px;
                  height: 100vh;
                  box-shadow: 0 0 1px rgb(0 0 0 / 50%);
                  align-items: center;
                  .logo {
                    margin-top: 10px;
                    text-align: center;
                    img {
                      height: 30px;
                    }
                  }
                  .items {
                    .item {
                      cursor: pointer;
                      margin: 20px 0;
                      text-align: center;
                      img {
                        height: 30px;
                      }
                    }
                  }
                  .setting {
                    margin-top: auto;
                    margin-bottom: 50px;
                    img {
                      height: 30px;
                    }
                  }
                }
                `
    },
    {
      id: "2",
      sendId: "2",
      toId: "1",
      msg: "来了"
    },
    {
      id: "3",
      sendId: "1",
      toId: "2",
      msg: "在干啥呢？"
    },
    {
      id: "4",
      sendId: "2",
      toId: "1",
      msg: "玩王者，你呢"
    }
  ];
  return msgData;
};

//搜索聊天
export const searchChat = (keyword: string) => {
  const list = getChatList();
  return list.filter((x) => x.chatName === keyword || x.message === keyword);
};

//搜索好友
export const searchFrend = (keyword: string) => {
  const list = getFrendList();
  return list.filter((x) => x.frendName === keyword || x.message === keyword);
};
